home *** CD-ROM | disk | FTP | other *** search
- #!/bin/csh -f
- # Installation script for MAEstro applications.
- # Copyright (C) 1994 by George D. Drapeau
- #
-
- set OsType = `uname -s` # Determine the operating system type
-
- if ($OsType != "SunOS") then # Is this a Sun workstation? If not, exit now
- echo "This operating system is not SunOS. Please install from a Sun workstation."
- exit (-1)
- endif
-
- set OsRelease = `uname -r` # What release of the operating system is this?
- switch ($OsRelease)
- case "4.*": # SunOS 4.X
- set RootDir = /cdrom/MAEstro/Applications # Set top-level directory from which to retrieve MAEstro software
- breaksw
- case "5.*": # SunOS 5.X
- set RootDir = /cdrom/unnamed_cdrom/MAEstro/Applications # Set top-level directory from which to retrieve MAEstro software
- breaksw
- default: # Probably not any SunOS
- echo "You are using either an unknown version of SunOS or are installing"
- echo "from a non-Sun workstation. Please install from a Sun workstation"
- echo "for the installation to work correctly."
- exit (-1)
- breaksw
- endsw
-
-
- set DestDir = "/usr/local/MAEstro" # Set up a default directory for the MAEstro applications
-
- set OsRelease = `uname -r` # What release of the operating system is this?
- switch ($OsRelease)
- case "4.*": # SunOS 4.X
- echo "Installing MAEstro applications for SunOS 4.X."
- set OsDir = "SunOS4"
- breaksw
- case "5.*": # SunOS 5.X
- echo "Installing MAEstro applications for Solaris 2.X."
- set OsDir = "Solaris2"
- breaksw
- default: # Probably not any SunOS
- echo "You are using either an unknown version of SunOS or are installing"
- echo "from a non-Sun workstation. Please install from a Sun workstation"
- echo "for the installation to work correctly."
- exit (-1)
- breaksw
- endsw
-
- set StrippedOrDebugDir = "stripped" # By default, install stripped binaries to save space
-
- if ($#argv > 0) then # Did the installer specify a command-line argument?
- if ($argv[1] == "debug") then # Yes, did the installer request binaries with debugging...
- set StrippedOrDebugDir = "debug" # ...symbols? If so, set the appropriate variable.
- else
- set StrippedOrDebugDir = "stripped"
- endif
- endif
-
- set MAEstroAppDir = "$RootDir/$OsDir/$StrippedOrDebugDir" # Determine where to find the correct MAEstro applications
-
- if (!(-e $MAEstroAppDir)) then
- echo "Cannot find the directory $RootDir. Please make sure"
- echo "that you have mounted the CD-ROM as /cdrom, then try"
- echo "this installation script again."
- exit (-1)
- endif
-
- set DiskSpaceNeeded = `du -s $MAEstroAppDir | awk '{print $1}'` # Determine disk space needed to install the MAEstro apps
-
- echo ""
- echo "The default installation directory is "
- echo " $DestDir"
- echo ""
- echo "The MAEstro applications require $DiskSpaceNeeded KB of disk space."
- echo ""
- echo "Would you like to install the MAEstro applications into "
- echo -n "'$DestDir'? [y/n] "
- set DestDir_ok = $< # Ask the installer if the default directory is okay.
-
-
- CustomInstallDirectory: # Here begins code to install apps in a custom directory
-
- if ($DestDir_ok != y) then # The default directory is not okay, prompt for a new place
- echo ""
- echo "Where would you like to install the MAEstro applications? "
- echo "(type 'q' to quit the installation process now.)"
- echo -n "--> "
- set DestDir = $<
- endif
-
- if ($DestDir == "q") then # Did the installer choose to exit without installing the software?
- echo "MAEstro applications were not installed."
- exit (-1) # Yes, honor that choice and quit right now
- endif
-
- if (!(-e $DestDir)) then # Does the specified directory exist?
- echo ""
- echo "The directory '$DestDir' does not exist."
- echo -n "Would you like to create it? [y/n] " # No, shall this program create such a directory?
- set create = $<
- if ($create == y) then # Yes, try to create the directory specified by the installer
- echo -n "Creating installation directory..."
- mkdir $DestDir >& /dev/null # Create the directory and set appropriate permissions
- if ($status != 0) then
- echo ""
- echo "Could not create the directory $DestDir."
- echo "Please try another directory name."
- echo ""
- goto CustomInstallDirectory
- endif
- chmod 0755 $DestDir
- echo "Done."
- else
- echo "Please try again:"
- echo ""
- goto CustomInstallDirectory
- endif
- else
- echo ""
- endif
-
-
- if (!(-e $DestDir/bin)) then # Does the "bin" directory exist?
- mkdir $DestDir/bin >& /dev/null # No, try to create it
- if ($status != 0) then # Did the creation fail?
- echo "" # Yes, report the error and exit without doing anything more
- echo "Could not create the directory $DestDir/bin."
- echo "Please make sure you have permission to create directories under"
- echo "$DestDir then run this installation script again."
- exit (-1)
- endif
- endif
-
- #
- # Avoid problems with long df entries...
- #
- set DF_LONG = `df $DestDir | tail -1 | awk '{print $4}' | egrep % | wc -c`
- if ( $DF_LONG == "0" ) then
- set FreeDiskSpace = `df $DestDir | tail -1 | awk '{print $4}'`
- else
- set FreeDiskSpace = `df $DestDir | tail -1 | awk '{print $3}'`
- endif
-
- if ($FreeDiskSpace < $DiskSpaceNeeded) then # Is there enough space to hold the MAEstro apps?
- echo "Sorry, the MAEstro applications require $DiskSpaceNeeded KB of free disk space" # No, inform the installer
- echo "but there are only $FreeDiskSpace KB free in '$DestDir'."
- echo "Please free up disk space or install MAEstro applications"
- echo "in a different directory, then run this installation script again."
- exit (-1) # Exit this script without doing any installation
- endif
-
-
- echo ""
- echo "Installing MAEstro applications into the directory '$DestDir/bin'..."
-
- pushd $MAEstroAppDir >& /dev/null # Go to the directory where the MAEstro apps reside
- foreach i (*) # Install each app individually, reporting status on each
- echo -n " $i..."
- cp $i $DestDir/bin # Copy this application into the desired directory
- echo "Installed."
- end
- popd >& /dev/null
-
- pushd $DestDir/bin >& /dev/null
- ln -s MaMA-30 MaMA >& /dev/null # Use the FrameMaker 3.X version of MaMA
- popd >& /dev/null
-
-
- echo ""
- echo "Installation was successful."
- echo ""
- echo "To use the MAEstro applications, make sure your PATH environment variable"
- echo "includes the directory '$DestDir/bin'."
- echo ""
- echo "For example, put the following line at the end of your .cshrc file:"
- echo " set path=($DestDir/bin" '$path)'
- echo ""
-
- exit (0) # Installation was successful; get outtahere.
-